﻿@model IEnumerable<FollowPeers.Models.Course>
@using WebMatrix.Data;
@using FollowPeers.Models;

@{
    ViewBag.Title = "Browse Courses";
}

@Html.Partial("_Header")
@Html.Partial("_SideBar1")
@Html.Partial("CourseRightSideBar")

@*Container*@
<div class="container">

@*rows within container*@
<div class="row">
    <div class="grid_9">
        <div class="box">
            <h2 style="height: 20px">Browse Courses</h2>
            @Html.ActionLink("Create New", "Create")
            <table style="margin:5px 0px 5px 0px">
            @{
                if (Model.Any(c => c.CourseId > 0))
                {
                    foreach (var item in Model)
                    {
                
                        <tr >
                            <td>
                                <div class="CourseContainer">
                                    <img src="@item.PhotoUrl" style="width:10%; height:48px; padding:5px 2px 5px 2px; display:inline-block; float:left;"/>
                                    <div class="courseDetails" style="width:73%;height:40px; float:left; padding: 5px 0px 0px 10px;">
                                        <div class="courseName"> @Html.ActionLink(item.CourseName, "Details", new { id = item.CourseId })</div>
                                        <div class="courseDescription">@Html.Label(item.CourseDescription)</div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    }

                }
                else
                {
                    <tr>
                        <td>There are not courses at present. You can add a course by clicking the button below.
                         </td>
                    </tr> 
                }        
            }
            </table>
        </div>
    </div>
    </div> <!--End Of Row-->

<div class="row">
@Html.Partial("_Footer")
 </div>

</div>
